/**
 * SDcardUtil.java
 * ImageChooser
 * 
 * Created by likebamboo on 2014-4-22
 * Copyright (c) 1998-2014 273.cn. All rights reserved.
 */

package com.hj.ct.util;

import java.io.File;

import android.os.Environment;

/**
 * SD卡操作工具类
 * 
 * @author likebamboo
 */
public class SDcardUtil {

    /**
     * 是否有SD卡
     * 
     * @return
     */
    public static boolean hasExternalStorage() {
        return Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED);
    }
    
    public static String getRootDir(){
    	String photo = Environment.getExternalStorageDirectory() + "/jiankongshebei/";
    	File file = new File(photo);
    	if(!file.exists()){
    		file.mkdirs();
    	}
    	return photo;
    }
    public static String getPicDir(){
    	File file = new File(getRootDir()+"pic/");
    	if(!file.exists()){
    		file.mkdirs();
    	}
    	return file.getAbsolutePath();
    }
    public static String getPicCacheDir(){
    	File file = new File(getRootDir()+"picCache/");
    	if(!file.exists()){
    		file.mkdirs();
    	}
    	return file.getAbsolutePath();
    }
    public static String getApkDir(){
    	File file = new File(getRootDir()+"apk/");
    	if(!file.exists()){
    		file.mkdirs();
    	}
    	return file.getAbsolutePath();
    }
}
